package com.mooco.dongba.sys.dao;

import com.mooco.dongba.common.pojo.CheckBox;
import com.mooco.dongba.sys.pojo.SysRole;
import com.mooco.dongba.sys.pojo.SysRoleMenuVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysRoleDao {
    int getRowCount(@Param("name") String name);

    List<SysRole> findPageObjects(
            @Param("name") String name,
            @Param("startIndex") Integer startIndex,
            @Param("pageSize") Integer pageSize);

    @Delete("delete from sys_roles where id=#{id}")
    int deleteObjectById(Long id);

    int insertObject(SysRole entity);

    @Select("select id,name,note from sys_roles where id=#{id}")
    SysRoleMenuVo findObjectById(Long id);

    int updateObject(SysRole entity);

    List<CheckBox> findObjects();
}
